//
//  BQCakeView.h
//  饼状图
//
//  Created by baiqiang on 16/1/27.
//  Copyright © 2016年 baiqiang. All rights reserved.
//

#import <UIKit/UIKit.h>



typedef struct cakeCharAngle {
    double startAngle;
    double endAngle;
} BQCakeCharAngle;

//CG_INLINE 宏定义为 static inline 内联函数
CG_INLINE BQCakeCharAngle BQCakeCharAngleMake(double start, double end) {
    BQCakeCharAngle angle;
    angle.startAngle = start;
    angle.endAngle = end;
    return angle;
}

@interface BQCakeViewLayer : CAShapeLayer
@property (nonatomic, assign) double angle;
/**
 *  layer的配置方法
 *
 *  @param angle  角度度量
 *  @param radius 半径
 */
- (void)completeAngleLayer:(BQCakeCharAngle)angle Radius:(CGFloat)radius;
@end

@interface BQCakeView : UIView


@property (nonatomic, copy) void (^clickedHandle)(NSInteger);

/**
 *  初始化View方法,数组count必须相同ratioes数组元素和为1
 *
 *  @param point   中心位置
 *  @param radius  半径
 *  @param colors  颜色数组
 *  @param ratioes 比例值
 *  @param offset  点击动画的位移量
 */
- (instancetype)initWithCenter:(CGPoint)point Radius:(CGFloat)radius colors:(NSArray <UIColor *> *)colors Ratioes:(NSArray <NSNumber *> *)ratioes offset:(CGFloat)offset;


@end
